package de.iritgo.skillfull.component.motion;

import de.iritgo.skillfull.component.Component;
import de.iritgo.skillfull.component.MotionComponentImpl;
import de.iritgo.skillfull.component.visitor.Visitor;

public class PositionComponentImpl extends MotionComponentImpl implements PositionComponent
{
	private float x;
	
	private float y;

	public float getX ()
	{
		return x;
	}

	public void setX (float x)
	{
		this.x = x;
	}

	public float getY ()
	{
		return y;
	}

	public void setY (float y)
	{
		this.y = y;
	}

	@Override
	public void accept (Visitor visitor)
	{
		visitor.visit (this);
		
		if (components == null)
			return;

		for (Component component : components)
		{
			component.accept (visitor);
		}
	}

	@Override
	public void printConfiguration ()
	{
		System.out.println ("** X: " + x + " Y:" + y + "relative: " + relative + " : " + this);
		
		if (components == null)
			return;

		for (Component component : components)
		{
			component.printConfiguration ();
		}
	}

	public void setPosition (int x, int y)
	{
		this.x = x;
		this.y = y;
	}
}
